import 'package:flutter/material.dart';
import 'package:shop/models/goods_data.dart';
import 'package:shop/util/http.dart';

class GoodsViewModel extends ChangeNotifier {
  List<Goods>? goodsList;

  void searchGoods(String text) async {
    final goodsData =
        await Http.request('/goods//search', param: {'query': text});

    goodsList = GoodsData.fromJson(goodsData).message?.goods ?? [];

    notifyListeners();
  }
}
